package com.demo.chapter10optional;

import java.util.Optional;
import com.demo.domain.Insurance;

public class MapDemo {
	
	public static void demo(Insurance insurance){
		Optional<Insurance> optInsurance = Optional.ofNullable(insurance);
		//如果Optional有值，就将值传递给map，如果没有值，就什么都不做
		Optional<String> name = optInsurance.map(Insurance::getName);
	}

}
